package com.shp.pojo;

import java.io.Serializable;

/**
 * 用于封装后端返回前端的数据对象
 * @author ZWL
 * @Auther:zwl
 * @Version: 1.0
 * @create: 2020/2/14 20:46
 */
public class ResultInfo implements Serializable {

    /**
     * 状态码
     */
    private Integer status;
    /**
     * 后端返回结果正常为true,发生异常返回false
     */
    private boolean flag = false;

    /**
     * 后端返回结果的数据对象
     */
    private Object datas;

    /**
     * 发生异常的错误信息
     */
    private String errorMsg;

    @Override
    public String toString() {
        return "ResultInfo{" +
                "status=" + status +
                ", flag=" + flag +
                ", datas=" + datas +
                ", errorMsg='" + errorMsg + '\'' +
                '}';
    }

    public ResultInfo(){}
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
    public ResultInfo(boolean flag) {
        this.flag = flag;
    }

    public ResultInfo(boolean flag, Object datas) {
        this.flag = flag;
        this.datas = datas;
    }

    public ResultInfo(boolean flag, Object datas, String errorMsg) {
        this.flag = flag;
        this.datas = datas;
        this.errorMsg = errorMsg;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public Object getDatas() {
        return datas;
    }

    public void setDatas(Object datas) {
        this.datas = datas;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
}
